package com.ruipengkj;

/**
 * 说明：检查图片下载缓存
 * 
 * @Author：孙航
 */

import com.ruipengkj.bean.TItempic;
import com.ruipengkj.bean.TLPic;
import com.ruipengkj.commons.BuildSpringApplication;
import com.ruipengkj.commons.util.ChangeFile;
import com.ruipengkj.service.TLPicService;

public class PicDownCache {
	private static TLPicService tLPicService;
	public static boolean checkDownCache(String fileName,TItempic tItempic) throws Exception
	{
		if(ApplicationContext.PICDOWMCACHE_SET.contains(fileName))
		{
			return true;
		}
		else
		{
			TLPic tLPic = new TLPic();		
			if(tLPicService==null){
				tLPicService = BuildSpringApplication.getInstance().getTLPicServiceImpl();
			}
			tLPic = tLPicService.getByIdService(tItempic.getName());
			ChangeFile.getFile(tLPic.getLPic(), "goodsImage/", tLPic.getName());
			ApplicationContext.PICDOWMCACHE_SET.add(fileName);	
			return false;
		}
	}

}
